﻿using System;
using Ensynch.FIM;
using Microsoft.ReportingServices.DataProcessing;

namespace FimDataProcessingExtension
{
    public sealed class FimDataParameter : IDataParameter
    {
        // Create a logger for use in this class.
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(
                System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        #region Variables

        private string m_paramName;
        private object m_value;

        #endregion

        #region Constructor

        public FimDataParameter()
        {
            // TODO: Implement default constructor
        }

        public FimDataParameter(string parameterName, object value)
        {
            #if TRACE
            FimTools.LogTrace(false);
            log.Debug("[FimDataParameter.ctor] " + parameterName + " = " + value);
            #endif

            this.m_paramName = parameterName;
            this.m_value = value;
        }

        #endregion

        #region IDataParameter

        string IDataParameter.ParameterName
        {
            get
            {
                return this.m_paramName;
            }
            set
            {
                #if TRACE
                FimTools.LogTrace(false);
                log.Debug("[IDataParameter.set_ParameterName] " + value);
                #endif

                this.m_paramName = value;
            }
        }

        object IDataParameter.Value
        {
            get
            {
                return this.m_value;
            }
            set
            {
                #if TRACE
                FimTools.LogTrace(false);
                log.Debug("[IDataParameter.set_Value] " + value);
                #endif

                this.m_value = value;
            }
        }

        #endregion
    }
}
